package com.shrw.duke.serialport.common.enity;

/**
 * Created by rw-duke on 2018/1/26.
 */

public class ActionLabelEnity extends BaseLabelEnity {
    private String actionId1;
    private String actionId2;
    private String actionId3;
    private String actionId4;
    private String actionRssi1;
    private String actionRssi2;
    private String actionRssi3;
    private String actionRssi4;
    private String devModel;
    private String actionModel;
    private String actionInterval;
    private String workCount;
    private String rev = "00000000000000000000000000000000";

    public String getActionId1() {
        return actionId1;
    }

    public void setActionId1(String actionId1) {
        this.actionId1 = actionId1;
    }

    public String getActionId2() {
        return actionId2;
    }

    public void setActionId2(String actionId2) {
        this.actionId2 = actionId2;
    }

    public String getActionId3() {
        return actionId3;
    }

    public void setActionId3(String actionId3) {
        this.actionId3 = actionId3;
    }

    public String getActionId4() {
        return actionId4;
    }

    public void setActionId4(String actionId4) {
        this.actionId4 = actionId4;
    }

    public String getActionRssi1() {
        return actionRssi1;
    }

    public void setActionRssi1(String actionRssi1) {
        this.actionRssi1 = actionRssi1;
    }

    public String getActionRssi2() {
        return actionRssi2;
    }

    public void setActionRssi2(String actionRssi2) {
        this.actionRssi2 = actionRssi2;
    }

    public String getActionRssi3() {
        return actionRssi3;
    }

    public void setActionRssi3(String actionRssi3) {
        this.actionRssi3 = actionRssi3;
    }

    public String getActionRssi4() {
        return actionRssi4;
    }

    public void setActionRssi4(String actionRssi4) {
        this.actionRssi4 = actionRssi4;
    }

    public String getDevModel() {
        return devModel;
    }

    public void setDevModel(String devModel) {
        this.devModel = devModel;
    }

    public String getActionModel() {
        return actionModel;
    }

    public void setActionModel(String actionModel) {
        this.actionModel = actionModel;
    }

    public String getActionInterval() {
        return actionInterval;
    }

    public void setActionInterval(String actionInterval) {
        this.actionInterval = actionInterval;
    }

    public String getWorkCount() {
        return workCount;
    }

    public void setWorkCount(String workCount) {
        this.workCount = workCount;
    }

    public String getRev() {
        return rev;
    }

    public void setRev(String rev) {
        this.rev = rev;
    }

    @Override
    public void parse(String instruction) {
        super.parse(instruction);
        cmd = "40";
        length = "0036";
        actionId1 = this.instruction.substring(26,30);
        actionRssi1 = this.instruction.substring(30,34);
        actionId2 = this.instruction.substring(34,38);
        actionRssi2 = this.instruction.substring(38,42);
        actionId3 = this.instruction.substring(42,46);
        actionRssi3 = this.instruction.substring(46,50);
        actionId4 = this.instruction.substring(50,54);
        actionRssi4 = this.instruction.substring(54,58);

        devModel = this.instruction.substring(58,62);
        actionModel = this.instruction.substring(62,66);
        actionInterval = this.instruction.substring(66,70);
        workCount = this.instruction.substring(70,74);
        rev = this.instruction.substring(70,102);
    }

    @Override
    public String toString() {
        instruction = new StringBuilder();
        instruction.append(head);
        instruction.append("0036");
        instruction.append(devId);
        instruction.append("40");
        instruction.append(sn);
        instruction.append(encryption);
        instruction.append(actionId1);
        instruction.append(actionRssi1);
        instruction.append(actionId2);
        instruction.append(actionRssi2);
        instruction.append(actionId3);
        instruction.append(actionRssi3);
        instruction.append(actionId4);
        instruction.append(actionRssi4);
        instruction.append(devModel);
        instruction.append(actionModel);
        instruction.append(actionInterval);
        instruction.append(workCount);
        instruction.append(rev);
        instruction.append(checkSum);
        return instruction.toString();
    }
}
